package com.hqyj.system.service.impl;


import com.hqyj.system.mapper.UserMapper;
import com.hqyj.system.model.User;
import com.hqyj.system.service.UserService;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

/**
 * @ClassName UserServiceImpl
 * @Description
 * @Author zlf
 * @Date 2021/9/8 9:58
 * @Version 1.0
 **/
@Service
public class UserServiceImpl implements UserService {
    //以属性的方式注入Mapper代理接口
    @Autowired
    private UserMapper userMapper;

    @Override
    public User queryUserByUser(User user) {
        return userMapper.queryUserByUser(user);
    }

    @Override
    public List<User> queryAllUser() {
        return userMapper.queryAllUser();
    }

    @Override
    public int deleteUserByuserId(int userId) {
        return userMapper.deleteByPrimaryKey(userId);
    }

    @Override
    public int addUserByUser(User user) {
        return userMapper.addUserByUser(user);
    }

    @Override
    public User queryUserByUserId(int userId) {
        return userMapper.selectByPrimaryKey(userId);
    }

    @Override
    public int updateUserByUser(User user) {
        return userMapper.updateUserByUser(user);
    }


    @Override
    public User queryUserByUsername(String username) {
        return userMapper.queryUserByUsername(username);
    }
}
